package edu.sctu.practice.class02.shilaihong.text.text03;

/**
 * Created by admin on 2015/10/12.
 */
public class MyTime {

    private int hour;
    private int minute;
    private int second;

    public MyTime(int hour, int minute, int second) {
        this.hour = hour;
        this.minute = minute;
        this.second = second;
    }

    //定义display方法;
    public void display() {
        System.out.println("时间为:" + this.hour + "时" + this.minute + "分" + this.second + "秒");
    }

    //分别对时、分、秒进行加减运算;
    public void addSecond(int sec) {
        second = second + sec;
    }

    public void addMinute(int min) {
        minute = minute + min;
    }

    public void addHour(int hou) {
        hour = hour + hou;
    }

    public void subSecond(int sec) {
        second = second - sec;
    }

    public void subMinute(int min) {
        minute = minute - min;
    }

    public void subHour(int hou) {
        hour = hour - hou;
    }

}

